function js_main1(s) {
  const stack = [];
  const arr = s.split('');
  for (const item of arr) {
    if (item === '(') {
      stack.push(')');
    } else if (item === '[') {
      stack.push(']');
    } else if (item === '{') {
      stack.push('}');
    } else if (stack.length === 0 || item !== stack.pop()) {
      return false;
    }
  }
  return stack.length === 0;
}

console.log(js_main1('()'));
console.log(js_main1('()[]{}'));
console.log(js_main1('(]'));
console.log(js_main1('([)]'));
console.log(js_main1('{[]}'));
